from loguru import logger
import os
from config import BASIC_PATH



class MyLogger:
    _logger_initialized = False

    def __init__(self):
        self.log=logger
        save_path = os.path.join(BASIC_PATH, 'log', 'log.log')
        print(save_path)
        self.log.add(sink=save_path, encoding='utf-8', enqueue=True, rotation="10 MB",retention="7 days")
        self.log.info('logger日志处理器初始化完成')


    def get_logger(self):
        return self.log


log=MyLogger()
def get_logger():
    return log.get_logger()